package com.leetcode.LC;

import java.util.HashMap;

public class LC1507 {
    public String reformatDate(String date) {

        String[] s = date.split(" ");
        HashMap<String, String> map = new HashMap<>();
        map.put("Jan","01");map.put("Feb","02");map.put("Mar","03");map.put("Apr","04");map.put("May","05");map.put("Jun","06");
        map.put("Jul","07");map.put("Aug","08");map.put("Sep","09");map.put("Oct","10");map.put("Nov","11");map.put("Dec","12");
        String str;
        if (s[0].length()==3){
            str="0"+s[0].substring(0,1);
        }else {
            str=s[0].substring(0,2);
        }
        return s[2]+"-"+map.get(s[1])+"-"+str;
    }
}
